<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class AddMealToWaimaiShoFinishSwitch extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::connection('mysqlWaiMaiAll')->create('waimai_shop_promise_switch', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('shopId')->default(0);
            $table->unsignedInteger('kfPromiseTime')->default(600)->comment('承诺出餐时间');
            $table->unsignedTinyInteger('elmPromiseSwitch')->default(0)->comment('饿了么承诺出餐开关 0关 1开');
            $table->unsignedInteger('elmPromiseTime')->default(0)->comment('饿了么承诺出餐时间');
            $table->unsignedInteger('silentSwitch')->default(0)->comment('静默自动出餐开关 0关 1开');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('updatedAt')->default(0)->comment('更新时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('更新人');

            $table->unique('shopId', 'idx_shopId');
            $table->comment = '外卖门店承诺出餐时间配置';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mysqlWaiMaiAll')->drop('waimai_shop_promise_switch');
    }
}
